<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <title>查看信息</title>
    <!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
    <link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.9/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" href="./../lib/layui/css/layui.css">
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
</head>

<body>
    <input type="text" name="imgurl" id="imgurl" value="" style="display:block;width:100%;height:50px;display:none;" />
    <div id="box" style="width:100%;display:none;"></div>
    <div class="page-container">
        <form action="" method="post" class="form form-horizontal" id="form-article-add">
            <input type="" name="" id="visible_input" value="1" style="display:none;" />
            <input type="" name="" id="isDiscount_input" value="2" style="display:none;" />
            <input type="" name="" id="isHot_input" value="2" style="display:none;" />
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">状态(可修改)：</label>
                <div class=" col-xs-8 col-sm-9">
                    <select name="" style="width: 100%" class="input-text" id="status" style="width:10%;">
                        <option value="">-请选择-</option>
                        <option value="0">正常</option>
                        <option value="1">冻结</option>
                        <option value="2">锁定</option>
                    </select>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">用户名(可修改)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="userId" name="">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">昵称(可修改)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text"  value="" placeholder="" id="nickName" name="">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">支付宝(可修改)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="zfb" name="">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">身份证号码(可修改)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="idCard" name="">
                </div>
            </div>
            <!-- 暂无字段，注释掉 -->
            <!-- <div class="row cl">
				<label class="form-label col-xs-4 col-sm-2">性别：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<div class="layui-form-item">
						<input type="radio" name="sex" value="男" title="男" checked>
						<!-- <input type="radio" name="sex" value="女" title="女" checked> -->
            <!-- </div> -->
            <!-- </div> -->
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">真实姓名(可修改)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="userName" name="">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">手机号(可修改)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="iphone" name="">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">推荐码：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" readonly="readonly" value="" placeholder="" id="referee" name="">
                </div>
            </div>
            <!-- <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">微信号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" readonly="readonly" value="" placeholder="" id="wx" name="">
                </div>
            </div> -->
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">美豆：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" readonly="readonly" value="" placeholder="" id="Beans" name="">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">购物金：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" readonly="readonly" value="" placeholder="" id="trade" name="">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"></label>
                <button onClick="save_submit();" class="btn btn-primary radius" type="button">提交</button>

                <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;关闭&nbsp;&nbsp;</button>

            </div>

        </form>
    </div>
    <input type="" name="select_vvv" id="select_vvv" value="" style="display:none;" />
    <script src="./../static/jquery.min.js"></script>
    <script type="text/javascript" src="./../static/js/common.js"></script>
    <script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="./../lib/layui/layui.js"></script>
    <script>
        var parentId = parent.$("#details_id").val();
        console.log(parentId)

        $(function () {
            $.ajax({
                type: "post",
                xhrFields: {
                    withCredentials: true
                },
                url: admin_url + '/kvmUser/userInfo',
                data: {
                    tokenUserId: userId,
                    token: token,
                    id: parentId
                },
                success: function (data) {
                    console.log(data)
                    if (data.code == 200) {
                        $("#status").val(data.data.status)
                        $("#zfb").val(data.data.alipay)
                        $("#idCard").val(data.data.idCard)
                        $("#userId").val(data.data.userName)
                        $("#iphone").val(data.data.mobile)
                        // $("#wx").val(data.data.wx)
                        $("#userName").val(data.data.name)
                        $("#referee").val(data.data.pollCode)
                        $("#nickName").val(data.data.nickName)
                        $.ajax({
                            type: "post",
                            xhrFields: {
                                withCredentials: true
                            },
                            url: admin_url + '/kvmAccount/getAccountByUserId',
                            data: {
                                tokenUserId: userId,
                                token: token,
                                userId: data.data.id
                            },
                            success: function (data) {
                                console.log(data)
                                if (data.code == 200 && data.data != null) {
                                    $("#Beans").val(data.data.md);
                                    $("#trade").val(data.data.gwj);
                                }
                            }
                        })
                    }
                }
            })
        })
        // 取消功能
        function layer_close() {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        }

        function save_submit() {
            var phone = $("#iphone").val(),
         
                idCard = $("#idCard").val(),
                userName = $("#userName").val(),
                status = $("#status option:selected").val(),
                zfb = $("#zfb").val(),
            idCard = $("#idCard").val(),
            nickName = $("#nickName").val(),
            userId = $("#userId").val();
            console.log(status)
                $.ajax({
                    type: "post",
                    xhrFields: {
                        withCredentials: true
                    },
                    url: admin_url + '/kvmUser/updUserInfo',
                    async: false,
                    data: {
                        tokenUserId: userId,
                        token: token,
                        id: parentId,
                        name: userName,
                        idCard: idCard,
                        mobile: phone,
                        status: status,
                        alipay: zfb,
                        nickName:nickName,
                        userName: userId
                    },
                    success: function (data) {
                        if (data.code == 200) {
                            layer.msg('修改成功', {
                                time: 1000,
                                end: function () {

                                    var index = parent.layer.getFrameIndex(window.name);
                                    parent.layer.close(index);
                                    $(window.parent.document).find('.layui-laypage-btn').click()
                                }
                            })
                        } else {
                            layer.msg(data.msg, {
                                time: 1500
                            })
                        }
                    }
                })
        }
    </script>
</body>

</html>